<template>
	<view class="flex align-center justify-between">
	  <image class="rounded-10" mode='aspectFit' :src="!api? item.logo_image : $_BASE_IMG_API + item.logo_image" :style="{width: imgSize, height: imgSize}"></image>
	  <view class="flex-1 flex justify-between u-m-l-20" style="height:120rpx;">
	    <view class="left flex-1 flex flex-column justify-between">
			<view class="text-ellipsis" style="width: 250rpx;">
				<text class="u-font-28" >{{item.store_name}}</text>
			</view>
			<view class="flex align-center u-m-t-16" style="height: 30rpx;line-height: 30rpx;">
				<view class="font-20" style="color:#ccc;">距你</view>
				<text class="u-p-l-10 u-font-24" style="color:var(--mainColor);">{{distanceFn(item.distance)}}</text>
			</view>
	    </view>
	    <view class="right flex align-center">
	      <view class="pr-2">
			<uni-tag text="进店逛逛" :circle="true" inverted customStyle="color: #ffffff; background-color: var(--mainColor); border-color: var(--mainColor);" @click="toSupplier"></uni-tag>
	      </view>
	    </view>
	  </view>
	</view>
</template>

<script>
	export default {
		name:"dy-supplier-sec-item",
    props:{
			api: {
				type: [Boolean,String],
				default: false
			},
      item: {
        type: Object,
        default() {
          return {}
        }
      },
      imgSize: {
        type: String,
        default: '147rpx'
      }
    },
		data() {
			return {
			};
		},
		methods: {
			distanceFn(distance){
				if(distance>1){
					return Math.floor(distance) + 'km'
				}else{
					return distance + 'km'
				}
			},
			toSupplier() {
				uni.navigateTo({
					url:'/pages/supplierPage/supplierIndex/supplierIndex?id=' + this.item.merch_id
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
